using UnityEngine;

public class StoreItemAdapter : MonoBehaviour
{
	public class ShoeAdapter
	{
		public virtual float GetSpeed(float shotsInPoint)
		{
			return 0f;
		}

		public virtual float GetJumpSpeed(int shotsInPoint)
		{
			return 0f;
		}

		public virtual float NormalizedVisualSpeed()
		{
			return 0f;
		}
	}

	public class StoreShoe : ShoeAdapter
	{
		private StoreItemsConfig.StoreItem shoe;

		public StoreShoe(StoreItemsConfig.StoreItem shoe)
		{
			this.shoe = shoe;
		}

		public override float GetSpeed(float shotsInPoint)
		{
			return shoe.GetSpeed(shotsInPoint);
		}

		public override float GetJumpSpeed(int shotsInPoint)
		{
			return shoe.GetJumpSpeed(shotsInPoint);
		}

		public override float NormalizedVisualSpeed()
		{
			return shoe.NormalizedVisualSpeed();
		}
	}

	public class MultiplayerShoe : ShoeAdapter
	{
		private StoreItemsConfig.StoreItem shoe;

		private StoreItemsConfig.StoreItem defaultShoe;

		private MultiplayerRooms.RoomInfo multiplayerRoom;

		public MultiplayerShoe(StoreItemsConfig.StoreItem shoe, MultiplayerRoomType roomType)
		{
			this.shoe = shoe;
			defaultShoe = StoreItemsConfig.instance.GetItemsForType(StoreItemsConfig.StoreItem.ItemType.Shoe, true)[0];
			multiplayerRoom = MultiplayerRooms.instance.FindRoomByType(roomType);
		}

		public override float GetSpeed(float shotsInPoint)
		{
			float speed = shoe.GetSpeed(shotsInPoint);
			float speed2 = defaultShoe.GetSpeed(shotsInPoint);
			return Mathf.Lerp(speed2, speed, multiplayerRoom.shoeInfluence);
		}

		public override float GetJumpSpeed(int shotsInPoint)
		{
			float jumpSpeed = shoe.GetJumpSpeed(shotsInPoint);
			float jumpSpeed2 = defaultShoe.GetJumpSpeed(shotsInPoint);
			return Mathf.Lerp(jumpSpeed2, jumpSpeed, multiplayerRoom.shoeInfluence);
		}

		public override float NormalizedVisualSpeed()
		{
			float b = shoe.NormalizedVisualSpeed();
			float a = defaultShoe.NormalizedVisualSpeed();
			return Mathf.Lerp(a, b, multiplayerRoom.shoeInfluence);
		}
	}

	public class RemoteShoe : ShoeAdapter
	{
		private FloatRange moveSpeed;

		private FloatRange jumpSpeed;

		private int shotsToMinSpeed;

		private float normalizedVisualSpeed;

		private MultiplayerRooms.RoomInfo multiplayerRoom;

		private StoreItemsConfig.StoreItem defaultShoe;

		public RemoteShoe(FloatRange moveSpeed, FloatRange jumpSpeed, int shotsToMinSpeed, float normalizedVisualSpeed, MultiplayerRoomType roomType)
		{
			this.moveSpeed = moveSpeed;
			this.jumpSpeed = jumpSpeed;
			this.shotsToMinSpeed = shotsToMinSpeed;
			multiplayerRoom = MultiplayerRooms.instance.FindRoomByType(roomType);
			this.normalizedVisualSpeed = normalizedVisualSpeed;
			defaultShoe = StoreItemsConfig.instance.GetItemsForType(StoreItemsConfig.StoreItem.ItemType.Shoe, true)[0];
		}

		public override float GetSpeed(float shotsInPoint)
		{
			float speed = StoreItemsConfig.StoreItem.GetSpeed(moveSpeed, shotsInPoint, shotsToMinSpeed);
			float speed2 = defaultShoe.GetSpeed(shotsInPoint);
			return Mathf.Lerp(speed2, speed, multiplayerRoom.shoeInfluence);
		}

		public override float GetJumpSpeed(int shotsInPoint)
		{
			float b = StoreItemsConfig.StoreItem.GetJumpSpeed(jumpSpeed, shotsInPoint, shotsToMinSpeed);
			float a = defaultShoe.GetJumpSpeed(shotsInPoint);
			return Mathf.Lerp(a, b, multiplayerRoom.shoeInfluence);
		}

		public override float NormalizedVisualSpeed()
		{
			float a = defaultShoe.NormalizedVisualSpeed();
			return Mathf.Lerp(a, normalizedVisualSpeed, multiplayerRoom.shoeInfluence);
		}
	}

	public class RacketAdapter
	{
		public virtual bool isNull
		{
			get
			{
				return true;
			}
		}

		public virtual float heightMult
		{
			get
			{
				return 0f;
			}
		}

		public virtual float topspinMult
		{
			get
			{
				return 0f;
			}
		}

		public virtual float xTableRangeMult
		{
			get
			{
				return 0f;
			}
		}

		public virtual float normalizedVisualSpeed
		{
			get
			{
				return 0f;
			}
		}
	}

	public class StoreRacket : RacketAdapter
	{
		private StoreItemsConfig.StoreItem racket;

		public override bool isNull
		{
			get
			{
				return racket == null;
			}
		}

		public override float heightMult
		{
			get
			{
				return racket.heightMult;
			}
		}

		public override float topspinMult
		{
			get
			{
				return racket.topspinMult;
			}
		}

		public override float xTableRangeMult
		{
			get
			{
				return racket.xTableRangeMult;
			}
		}

		public override float normalizedVisualSpeed
		{
			get
			{
				return racket.NormalizedVisualSpeed();
			}
		}

		public StoreRacket(StoreItemsConfig.StoreItem racket)
		{
			this.racket = racket;
		}
	}

	public class MultiplayerRacket : RacketAdapter
	{
		private StoreItemsConfig.StoreItem racket;

		private StoreItemsConfig.StoreItem defaultRacket;

		private MultiplayerRooms.RoomInfo multiplayerRoom;

		public override bool isNull
		{
			get
			{
				return racket == null;
			}
		}

		public override float heightMult
		{
			get
			{
				return Mathf.Lerp(defaultRacket.heightMult, racket.heightMult, multiplayerRoom.racketInfluence);
			}
		}

		public override float topspinMult
		{
			get
			{
				return Mathf.Lerp(defaultRacket.topspinMult, racket.topspinMult, multiplayerRoom.racketInfluence);
			}
		}

		public override float xTableRangeMult
		{
			get
			{
				return Mathf.Lerp(defaultRacket.xTableRangeMult, racket.xTableRangeMult, multiplayerRoom.racketInfluence);
			}
		}

		public override float normalizedVisualSpeed
		{
			get
			{
				return Mathf.Lerp(defaultRacket.NormalizedVisualSpeed(), racket.NormalizedVisualSpeed(), multiplayerRoom.racketInfluence);
			}
		}

		public MultiplayerRacket(StoreItemsConfig.StoreItem racket, MultiplayerRoomType roomType)
		{
			this.racket = racket;
			defaultRacket = StoreItemsConfig.instance.GetItemsForType(StoreItemsConfig.StoreItem.ItemType.Racket, true)[0];
			multiplayerRoom = MultiplayerRooms.instance.FindRoomByType(roomType);
		}
	}
}
